package com.linjiahao.netty;

import com.linjiahao.netty.server.NettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@Slf4j
public class NettyChatApplication implements CommandLineRunner {

    @Autowired
    NettyServer nettyServer;

    public static void main(String[] args) {
        SpringApplication.run(NettyChatApplication.class, args);
    }


    @Override
    public void run(String... args){
        try {
            nettyServer.start();
            log.info("netty服务启动成功");
        }catch (Exception e){
            log.error("netty服务启动失败：{}",e);
        }

    }
}
